package meta

import "strings"

type DictionaryMeta struct {
	//字典键的字段
	key string
	//字典类型的字段
	form string
	//字典值的字段
	value string
	//字典备注的字段
	comment string
}

func (d *DictionaryMeta) Key() string {
	return d.key
}
func (d *DictionaryMeta) Form() string {
	return d.form
}
func (d *DictionaryMeta) Comment() string {
	return d.comment
}

func NewDictionaryMeta(metaDefine string) *DictionaryMeta {
	var meta DictionaryMeta
	parts := strings.Split(metaDefine, " ")

	meta.key = parts[1]
	meta.form = parts[2]
	meta.value = parts[3]
	if len(parts) > 4 {
		meta.comment = parts[4]
	}
	return &meta
}
